c8a458
@@ -17,13 +17,16 @@
 package org.apache.camel.component.cxf.interceptors;
 
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.io.OutputStream;
+import java.io.Writer;
 import java.util.List;
 
 import org.apache.camel.StreamCache;
 import org.apache.camel.util.IOHelper;
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
 import org.apache.cxf.phase.Phase;
@@ -49,16 +52,20 @@
public class RawMessageContentRedirectInterceptor extends AbstractPhaseIntercept
         if (null != params) {
             InputStream is = (InputStream)params.get(0);
             OutputStream os = message.getContent(OutputStream.class);
-            if (os == null) {
+            Writer writer = message.getContent(Writer.class);
+            if (os == null && writer == null) {
                 //InOny
                 return;
             }
-
             try {
-                if (is instanceof StreamCache) {
-                    ((StreamCache)is).writeTo(os);
+                if (os == null && writer != null) {
+                    IOUtils.copyAndCloseInput(new InputStreamReader(is), writer);
                 } else {
-                    IOUtils.copy(is, os);
+                    if (is instanceof StreamCache) {
+                        ((StreamCache)is).writeTo(os);
+                    } else {
+                        IOUtils.copy(is, os);
+                    }
                 }
             } catch (Exception e) {
                 throw new Fault(e);
